const state = {
  defaultOrderNum:"",
  relateTypeInfo:{
    relateTypeName:"",
    relateType:""
  },
  relateOrders:"",
  planTime:"",
  applyPerson:{
    username:"",
    nickname:"",
    mobile:""
  },
  provideCompany:""
}

const mutations = {
  SET_DEFAULT_ORDER_NUM: (state, orderNumber) => {
    state.defaultOrderNum = orderNumber;
  },
  SET_RELATE_ORDERS:(state, relateOrders) => {
    state.relateOrders = relateOrders;
  },
  SET_RELATE_TYPE_INFO:(state, relateTypeInfo) => {
    state.relateTypeInfo = relateTypeInfo;
  },
  SET_PLAN_TIME:(state, planTime) => {
    state.planTime = planTime;
  },
  SET_APPLY_PERSON:(state, applyPerson) => {
    state.applyPerson = applyPerson;
  },
  SET_PROVIDE_COMPANY:(state, provideCompany) => {
    state.provideCompany = provideCompany;
  }
}

const actions = {
  clearCjOrderNumber({commit}) {
    commit('SET_DEFAULT_ORDER_NUM', "");
  },
  clearCjStore({commit}){
    // commit('SET_DEFAULT_ORDER_NUM', "");
    commit('SET_RELATE_ORDERS', "");
    // commit('SET_RELATE_TYPE_INFO', {}); // 选不需要清楚关联单据类型 ，因为有页面跳转
    commit('SET_PLAN_TIME', "");
    commit('SET_APPLY_PERSON', {});
    commit('SET_PROVIDE_COMPANY', "");
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
